<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>援藏路线新增</title>
    <base href="${pageContext.request.contextPath }/"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="./Process/style.css"/>
    <script type="text/javascript" src="./Process/create.js"></script>
    <script type="text/javascript" src="./Js/jquery.js"></script>
</head>
<body>
<div>
    路线名称：
    <input type="text" name="title" id="title" value=""/>
    <br/>
    <input id="info" style="width: 300px" name="info" placeholder="请输入节点以‘-’分隔"/>
<%--    <input type="button" value="增加" onclick="add();"/>--%>
    <input type="button" id="submit" value="提交"/>
</div>
</body>
<script type="text/javascript">
    $("#backid").click(function () {
        window.location.href = "/process/list";
    });
    $("#submit").click(function () {
        var title = $("#title").val();
        var info = $("#info").val();
        var param = "title=" + title + "&info=" + info+"&operator=${username}";
        $.ajax({
            url: "/process/add",
            type: "post",
            async: true,
            data: param,
            success: function (res) {
                if (res.success) {
                    alert("添加成功！")
                    window.location.href = "/process/list";
                } else {
                    alert(res.message);
                }
            }, error: function (e) {
                alert(e)
            }
        });
    })
</script>
</html>